package com.zbkj.front.controller;

import com.zbkj.dal.base.result.CommonResult;
import com.zbkj.dal.entity.partner.PartnerRole;
import com.zbkj.dal.pojo.response.partner.PartnerRoleResponse;
import com.zbkj.service.service.PartnerRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("api/front/userPartnerRole")
@Api(tags = "合伙人角色控制器")
public class PartnerRoleController {
    @Autowired
    private PartnerRoleService partnerRoleService;

    @ApiOperation(value = "合伙人角色卡列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<List<PartnerRoleResponse>> list() {
        return CommonResult.success(partnerRoleService.listUserPartnerRole());
    }

    @ApiOperation(value = "预购买合伙人角色卡")
    @RequestMapping(value = "/bayPartnerRoleCard/{pid}", method = RequestMethod.GET)
    public CommonResult<String> bayPartnerRoleCard(@PathVariable(name = "pid") Integer pid) {
        return CommonResult.success(partnerRoleService.bayPartnerRoleCard(pid));
    }

    @ApiOperation(value = "购买合伙人角色卡")
    @RequestMapping(value = "/payPartnerRoleCard/{orderNo}", method = RequestMethod.GET)
    public CommonResult<Map<String, String>> list(@PathVariable(name = "orderNo") String orderNo) {
        return CommonResult.success(partnerRoleService.payPartnerRoleCard(orderNo));
    }

    @ApiOperation(value = "test")
    @GetMapping(value = "/test")
    public CommonResult<?> test() {
        partnerRoleService.test();
        return CommonResult.success();
    }
}
